using Circus.CodeEditor;
using Circus.CodeEditor.TextSource;
using Circus.Syntax.Lexer;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Circus.CodeEditor.Dialogs
{
	public class DlgSyntaxSettings : Form
	{
		private const int openFolderImage = 0;
		private const int closeFolderImage = 1;
		private const int selectedImage = 2;
		private const int unSelectedImage = 3;
		private IContainer components;
		public Panel pnButtons;
		public Button btCancel;
		public Button btOK;
		public Panel pnMain;
		public Panel pnTree;
		public TreeView tvProperties;
		public Panel pnManage;
		public ImageList imageList1;
		public ColorDialog colorDialog1;
		public TabControl tcMain;
		public TabPage tpGeneral;
		public TabPage tpFontsAndColors;
		public TabPage tpAdditional;
		public Panel pnGeneral;
		public GroupBox gbGutterMargin;
		public CheckBox chbShowMargin;
		public Label laGutterWidth;
		public CheckBox chbShowGutter;
		public Label laMarginPosition;
		public GroupBox gbDocument;
		public CheckBox chbDragAndDrop;
		public CheckBox chbHorzScrollBar;
		public CheckBox chbVertScrollBar;
		public CheckBox chbWordWrap;
		public CheckBox chbHighlightUrls;
		public Panel pnFontsColors;
		public Label laDisplayItems;
		public Panel pnSampleText;
		public Label laSampleText;
		public Label laSample;
		public Label laSize;
		public Label laFont;
		public ComboBox cbFontName;
		public Label laDescription;
		public TextBox tbDescription;
		public Label laBackColor;
		public Label laForeColor;
		public ListBox lbStyles;
		public GroupBox gbFontAttributes;
		public CheckBox chbUnderline;
		public CheckBox chbItalic;
		public CheckBox chbBold;
		public Panel pnAdditional;
		public GroupBox gbTabOptions;
		public TextBox tbTabStops;
		public RadioButton rbKeepTabs;
		public RadioButton rbInsertSpaces;
		public Label laTabSizes;
		public GroupBox gbOutlineOptions;
		public CheckBox chbAllowOutlining;
		public CheckBox chbShowHints;
		public GroupBox gbNavigateOptions;
		public CheckBox chbMoveOnRightButton;
		public CheckBox chbBeyondEof;
		public CheckBox chbBeyondEol;
		public ColorBox cbForeColor;
		public ColorBox cbBackColor;
		public GroupBox gbLineNumbers;
		public CheckBox chbLineNumbers;
		public CheckBox chbLineNumbersOnGutter;
		public TextBox tbGutterWidth;
		public TextBox tbMarginPosition;
		public TextBox tbFontSize;
		private CheckBox chbForced;
		public TabPage tpKeyboard;
		public Panel pnKeyboard;
		private Label laKeyboardMappingScheme;
		private Button btSaveSchemeAs;
		private Button btDeleteScheme;
		private Label laShowCommands;
		private TextBox tbShowCommands;
		private ListBox lbEventHandlers;
		private Label laShortcuts;
		private ComboBox cbShortcuts;
		private ComboBox cbKeyboardSchemes;
		private GroupBox gbColorThemes;
		private ComboBox cbColorThemes;
		private Button btAddColorTheme;
		private Button btDeleteColorTheme;
		private CheckBox chbLineSeparator;
		public CheckBox chbLineModificator;
		public CheckBox chbWhiteSpace;
		private SyntaxSettings syntaxSettings;
		private Color curForeColor;
		private Color curBkColor;
		private FontStyle curFontStyle;
		private string curDesc;
		private bool isControlUpdating;
		private bool isFontControlsUpdating = false;
		private TreeNode rootNode;
		private TreeNode generalNode;
		private TreeNode fontsNode;
		private TreeNode keyboardNode;
		private TreeNode additionalNode;
		private string sControl = "control";
		private string sCtrl = "CTRL";
		private string sAlt = "alt";
		private string sShift = "shift";
		public SyntaxSettings SyntaxSettings
		{
			get
			{
				return this.syntaxSettings;
			}
			set
			{
				this.syntaxSettings.Assign(value);
			}
		}
		public DlgSyntaxSettings()
		{
			this.InitializeComponent();
			this.syntaxSettings = this.CreateSyntaxSettings();
			this.rootNode = this.tvProperties.Nodes[0];
			this.generalNode = this.rootNode.Nodes[0];
			this.fontsNode = this.rootNode.Nodes[1];
			this.additionalNode = this.rootNode.Nodes[2];
			this.keyboardNode = this.rootNode.Nodes[3];
		}
		public DlgSyntaxSettings(EditorSettingsTab hiddenTabs) : this()
		{
			this.UpdateHiddenTabs(hiddenTabs);
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (this.components != null)
				{
					this.components.Dispose();
				}
			}
			base.Dispose(disposing);
		}
		protected virtual SyntaxSettings CreateSyntaxSettings()
		{
			return new SyntaxSettings();
		}
		private void InitializeComponent()
		{
			this.components = new Container();
			TreeNode treeNode = new TreeNode("General");
			TreeNode treeNode2 = new TreeNode("Fonts and Colors");
			TreeNode treeNode3 = new TreeNode("Additional");
			TreeNode treeNode4 = new TreeNode("Keyboard");
			TreeNode treeNode5 = new TreeNode("Options", 1, 0, new TreeNode[]
			{
				treeNode,
				treeNode2,
				treeNode3,
				treeNode4
			});
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(DlgSyntaxSettings));
			this.pnButtons = new Panel();
			this.btCancel = new Button();
			this.btOK = new Button();
			this.pnMain = new Panel();
			this.pnManage = new Panel();
			this.tcMain = new TabControl();
			this.tpGeneral = new TabPage();
			this.pnGeneral = new Panel();
			this.gbLineNumbers = new GroupBox();
			this.chbLineNumbers = new CheckBox();
			this.chbLineNumbersOnGutter = new CheckBox();
			this.gbGutterMargin = new GroupBox();
			this.tbMarginPosition = new TextBox();
			this.tbGutterWidth = new TextBox();
			this.chbShowMargin = new CheckBox();
			this.laGutterWidth = new Label();
			this.chbShowGutter = new CheckBox();
			this.laMarginPosition = new Label();
			this.gbDocument = new GroupBox();
			this.chbLineSeparator = new CheckBox();
			this.chbLineModificator = new CheckBox();
			this.chbWhiteSpace = new CheckBox();
			this.chbForced = new CheckBox();
			this.chbDragAndDrop = new CheckBox();
			this.chbHorzScrollBar = new CheckBox();
			this.chbVertScrollBar = new CheckBox();
			this.chbWordWrap = new CheckBox();
			this.chbHighlightUrls = new CheckBox();
			this.tpAdditional = new TabPage();
			this.pnAdditional = new Panel();
			this.gbTabOptions = new GroupBox();
			this.tbTabStops = new TextBox();
			this.rbKeepTabs = new RadioButton();
			this.rbInsertSpaces = new RadioButton();
			this.laTabSizes = new Label();
			this.gbOutlineOptions = new GroupBox();
			this.chbAllowOutlining = new CheckBox();
			this.chbShowHints = new CheckBox();
			this.gbNavigateOptions = new GroupBox();
			this.chbMoveOnRightButton = new CheckBox();
			this.chbBeyondEof = new CheckBox();
			this.chbBeyondEol = new CheckBox();
			this.tpFontsAndColors = new TabPage();
			this.pnFontsColors = new Panel();
			this.cbForeColor = new ColorBox(this.components);
			this.cbBackColor = new ColorBox(this.components);
			this.gbColorThemes = new GroupBox();
			this.btDeleteColorTheme = new Button();
			this.btAddColorTheme = new Button();
			this.cbColorThemes = new ComboBox();
			this.tbFontSize = new TextBox();
			this.laDisplayItems = new Label();
			this.pnSampleText = new Panel();
			this.laSampleText = new Label();
			this.laSample = new Label();
			this.laSize = new Label();
			this.laFont = new Label();
			this.cbFontName = new ComboBox();
			this.laDescription = new Label();
			this.tbDescription = new TextBox();
			this.laBackColor = new Label();
			this.laForeColor = new Label();
			this.lbStyles = new ListBox();
			this.gbFontAttributes = new GroupBox();
			this.chbUnderline = new CheckBox();
			this.chbItalic = new CheckBox();
			this.chbBold = new CheckBox();
			this.tpKeyboard = new TabPage();
			this.pnKeyboard = new Panel();
			this.cbShortcuts = new ComboBox();
			this.laShortcuts = new Label();
			this.lbEventHandlers = new ListBox();
			this.tbShowCommands = new TextBox();
			this.laShowCommands = new Label();
			this.btDeleteScheme = new Button();
			this.btSaveSchemeAs = new Button();
			this.cbKeyboardSchemes = new ComboBox();
			this.laKeyboardMappingScheme = new Label();
			this.pnTree = new Panel();
			this.tvProperties = new TreeView();
			this.imageList1 = new ImageList(this.components);
			this.colorDialog1 = new ColorDialog();
			this.pnButtons.SuspendLayout();
			this.pnMain.SuspendLayout();
			this.pnManage.SuspendLayout();
			this.tcMain.SuspendLayout();
			this.tpGeneral.SuspendLayout();
			this.pnGeneral.SuspendLayout();
			this.gbLineNumbers.SuspendLayout();
			this.gbGutterMargin.SuspendLayout();
			this.gbDocument.SuspendLayout();
			this.tpAdditional.SuspendLayout();
			this.pnAdditional.SuspendLayout();
			this.gbTabOptions.SuspendLayout();
			this.gbOutlineOptions.SuspendLayout();
			this.gbNavigateOptions.SuspendLayout();
			this.tpFontsAndColors.SuspendLayout();
			this.pnFontsColors.SuspendLayout();
			this.gbColorThemes.SuspendLayout();
			this.pnSampleText.SuspendLayout();
			this.gbFontAttributes.SuspendLayout();
			this.tpKeyboard.SuspendLayout();
			this.pnKeyboard.SuspendLayout();
			this.pnTree.SuspendLayout();
			base.SuspendLayout();
			this.pnButtons.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.pnButtons.BorderStyle = BorderStyle.Fixed3D;
			this.pnButtons.Controls.Add(this.btCancel);
			this.pnButtons.Controls.Add(this.btOK);
			this.pnButtons.Location = new Point(0, 360);
			this.pnButtons.Name = "pnButtons";
			this.pnButtons.Size = new Size(556, 40);
			this.pnButtons.TabIndex = 6;
			this.btCancel.DialogResult = DialogResult.Cancel;
			this.btCancel.FlatStyle = FlatStyle.System;
			this.btCancel.Location = new Point(463, 5);
			this.btCancel.Name = "btCancel";
			this.btCancel.Size = new Size(75, 23);
			this.btCancel.TabIndex = 1;
			this.btCancel.Text = "Cancel";
			this.btOK.DialogResult = DialogResult.OK;
			this.btOK.FlatStyle = FlatStyle.System;
			this.btOK.Location = new Point(383, 5);
			this.btOK.Name = "btOK";
			this.btOK.Size = new Size(75, 23);
			this.btOK.TabIndex = 0;
			this.btOK.Text = "OK";
			this.btOK.Click += new EventHandler(this.btOK_Click);
			this.pnMain.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.pnMain.Controls.Add(this.pnManage);
			this.pnMain.Controls.Add(this.pnTree);
			this.pnMain.Location = new Point(0, 0);
			this.pnMain.Name = "pnMain";
			this.pnMain.Size = new Size(552, 360);
			this.pnMain.TabIndex = 7;
			this.pnManage.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.pnManage.Controls.Add(this.tcMain);
			this.pnManage.Location = new Point(136, 0);
			this.pnManage.Name = "pnManage";
			this.pnManage.Size = new Size(416, 360);
			this.pnManage.TabIndex = 1;
			this.tcMain.Controls.Add(this.tpGeneral);
			this.tcMain.Controls.Add(this.tpAdditional);
			this.tcMain.Controls.Add(this.tpFontsAndColors);
			this.tcMain.Controls.Add(this.tpKeyboard);
			this.tcMain.Dock = DockStyle.Fill;
			this.tcMain.Location = new Point(0, 0);
			this.tcMain.Name = "tcMain";
			this.tcMain.SelectedIndex = 0;
			this.tcMain.Size = new Size(416, 360);
			this.tcMain.TabIndex = 0;
			this.tcMain.Visible = false;
			this.tpGeneral.Controls.Add(this.pnGeneral);
			this.tpGeneral.Location = new Point(4, 22);
			this.tpGeneral.Name = "tpGeneral";
			this.tpGeneral.Size = new Size(408, 334);
			this.tpGeneral.TabIndex = 0;
			this.tpGeneral.Text = "General";
			this.pnGeneral.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.pnGeneral.BackColor = SystemColors.Control;
			this.pnGeneral.Controls.Add(this.gbLineNumbers);
			this.pnGeneral.Controls.Add(this.gbGutterMargin);
			this.pnGeneral.Controls.Add(this.gbDocument);
			this.pnGeneral.Location = new Point(0, 0);
			this.pnGeneral.Name = "pnGeneral";
			this.pnGeneral.Size = new Size(424, 368);
			this.pnGeneral.TabIndex = 1;
			this.pnGeneral.Visible = false;
			this.gbLineNumbers.Controls.Add(this.chbLineNumbers);
			this.gbLineNumbers.Controls.Add(this.chbLineNumbersOnGutter);
			this.gbLineNumbers.FlatStyle = FlatStyle.System;
			this.gbLineNumbers.Location = new Point(8, 200);
			this.gbLineNumbers.Name = "gbLineNumbers";
			this.gbLineNumbers.Size = new Size(384, 72);
			this.gbLineNumbers.TabIndex = 39;
			this.gbLineNumbers.TabStop = false;
			this.gbLineNumbers.Text = "Line Numbers";
			this.chbLineNumbers.FlatStyle = FlatStyle.System;
			this.chbLineNumbers.Location = new Point(8, 16);
			this.chbLineNumbers.Name = "chbLineNumbers";
			this.chbLineNumbers.Size = new Size(200, 25);
			this.chbLineNumbers.TabIndex = 0;
			this.chbLineNumbers.Text = "Show Line Numbers";
			this.chbLineNumbersOnGutter.FlatStyle = FlatStyle.System;
			this.chbLineNumbersOnGutter.Location = new Point(8, 41);
			this.chbLineNumbersOnGutter.Name = "chbLineNumbersOnGutter";
			this.chbLineNumbersOnGutter.Size = new Size(200, 25);
			this.chbLineNumbersOnGutter.TabIndex = 1;
			this.chbLineNumbersOnGutter.Text = "Display on Gutter";
			this.gbGutterMargin.Controls.Add(this.tbMarginPosition);
			this.gbGutterMargin.Controls.Add(this.tbGutterWidth);
			this.gbGutterMargin.Controls.Add(this.chbShowMargin);
			this.gbGutterMargin.Controls.Add(this.laGutterWidth);
			this.gbGutterMargin.Controls.Add(this.chbShowGutter);
			this.gbGutterMargin.Controls.Add(this.laMarginPosition);
			this.gbGutterMargin.FlatStyle = FlatStyle.System;
			this.gbGutterMargin.Location = new Point(8, 116);
			this.gbGutterMargin.Name = "gbGutterMargin";
			this.gbGutterMargin.Size = new Size(384, 72);
			this.gbGutterMargin.TabIndex = 38;
			this.gbGutterMargin.TabStop = false;
			this.gbGutterMargin.Text = "Gutter&&Margin";
			this.tbMarginPosition.Location = new Point(324, 40);
			this.tbMarginPosition.Name = "tbMarginPosition";
			this.tbMarginPosition.Size = new Size(48, 20);
			this.tbMarginPosition.TabIndex = 8;
			this.tbMarginPosition.Text = "0";
			this.tbMarginPosition.KeyPress += new KeyPressEventHandler(this.tbMarginPosition_KeyPress);
			this.tbGutterWidth.Location = new Point(324, 16);
			this.tbGutterWidth.Name = "tbGutterWidth";
			this.tbGutterWidth.Size = new Size(48, 20);
			this.tbGutterWidth.TabIndex = 7;
			this.tbGutterWidth.Text = "0";
			this.tbGutterWidth.KeyPress += new KeyPressEventHandler(this.tbGutterWidth_KeyPress);
			this.chbShowMargin.FlatStyle = FlatStyle.System;
			this.chbShowMargin.Location = new Point(8, 41);
			this.chbShowMargin.Name = "chbShowMargin";
			this.chbShowMargin.Size = new Size(136, 25);
			this.chbShowMargin.TabIndex = 1;
			this.chbShowMargin.Text = "Show Margin";
			this.laGutterWidth.FlatStyle = FlatStyle.System;
			this.laGutterWidth.Location = new Point(160, 16);
			this.laGutterWidth.Name = "laGutterWidth";
			this.laGutterWidth.Size = new Size(152, 25);
			this.laGutterWidth.TabIndex = 3;
			this.laGutterWidth.Text = "Gutter width:";
			this.chbShowGutter.FlatStyle = FlatStyle.System;
			this.chbShowGutter.Location = new Point(8, 16);
			this.chbShowGutter.Name = "chbShowGutter";
			this.chbShowGutter.Size = new Size(136, 25);
			this.chbShowGutter.TabIndex = 0;
			this.chbShowGutter.Text = "Show Gutter";
			this.laMarginPosition.FlatStyle = FlatStyle.System;
			this.laMarginPosition.Location = new Point(160, 41);
			this.laMarginPosition.Name = "laMarginPosition";
			this.laMarginPosition.Size = new Size(152, 25);
			this.laMarginPosition.TabIndex = 4;
			this.laMarginPosition.Text = "Margin position:";
			this.gbDocument.Controls.Add(this.chbLineSeparator);
			this.gbDocument.Controls.Add(this.chbLineModificator);
			this.gbDocument.Controls.Add(this.chbWhiteSpace);
			this.gbDocument.Controls.Add(this.chbForced);
			this.gbDocument.Controls.Add(this.chbDragAndDrop);
			this.gbDocument.Controls.Add(this.chbHorzScrollBar);
			this.gbDocument.Controls.Add(this.chbVertScrollBar);
			this.gbDocument.Controls.Add(this.chbWordWrap);
			this.gbDocument.Controls.Add(this.chbHighlightUrls);
			this.gbDocument.FlatStyle = FlatStyle.System;
			this.gbDocument.Location = new Point(8, 8);
			this.gbDocument.Name = "gbDocument";
			this.gbDocument.Size = new Size(384, 98);
			this.gbDocument.TabIndex = 11;
			this.gbDocument.TabStop = false;
			this.gbDocument.Text = "Document";
			this.chbLineSeparator.FlatStyle = FlatStyle.System;
			this.chbLineSeparator.Location = new Point(250, 66);
			this.chbLineSeparator.Name = "chbLineSeparator";
			this.chbLineSeparator.Size = new Size(122, 25);
			this.chbLineSeparator.TabIndex = 8;
			this.chbLineSeparator.Text = "Line separator";
			this.chbLineModificator.FlatStyle = FlatStyle.System;
			this.chbLineModificator.Location = new Point(250, 41);
			this.chbLineModificator.Name = "chbLineModificator";
			this.chbLineModificator.Size = new Size(122, 25);
			this.chbLineModificator.TabIndex = 7;
			this.chbLineModificator.Text = "Line modificator";
			this.chbWhiteSpace.FlatStyle = FlatStyle.System;
			this.chbWhiteSpace.Location = new Point(250, 16);
			this.chbWhiteSpace.Name = "chbWhiteSpace";
			this.chbWhiteSpace.Size = new Size(122, 25);
			this.chbWhiteSpace.TabIndex = 6;
			this.chbWhiteSpace.Text = "White space";
			this.chbForced.FlatStyle = FlatStyle.System;
			this.chbForced.Location = new Point(130, 66);
			this.chbForced.Name = "chbForced";
			this.chbForced.Size = new Size(122, 25);
			this.chbForced.TabIndex = 5;
			this.chbForced.Text = "Forced scroll bars";
			this.chbDragAndDrop.FlatStyle = FlatStyle.System;
			this.chbDragAndDrop.Location = new Point(8, 66);
			this.chbDragAndDrop.Name = "chbDragAndDrop";
			this.chbDragAndDrop.Size = new Size(144, 25);
			this.chbDragAndDrop.TabIndex = 2;
			this.chbDragAndDrop.Text = "&Drag and drop text";
			this.chbHorzScrollBar.FlatStyle = FlatStyle.System;
			this.chbHorzScrollBar.Location = new Point(130, 41);
			this.chbHorzScrollBar.Name = "chbHorzScrollBar";
			this.chbHorzScrollBar.Size = new Size(122, 25);
			this.chbHorzScrollBar.TabIndex = 4;
			this.chbHorzScrollBar.Text = "&Horizontal scroll bar";
			this.chbVertScrollBar.FlatStyle = FlatStyle.System;
			this.chbVertScrollBar.Location = new Point(130, 16);
			this.chbVertScrollBar.Name = "chbVertScrollBar";
			this.chbVertScrollBar.Size = new Size(122, 25);
			this.chbVertScrollBar.TabIndex = 3;
			this.chbVertScrollBar.Text = "&Vertical scroll bar";
			this.chbWordWrap.FlatStyle = FlatStyle.System;
			this.chbWordWrap.Location = new Point(8, 16);
			this.chbWordWrap.Name = "chbWordWrap";
			this.chbWordWrap.Size = new Size(124, 25);
			this.chbWordWrap.TabIndex = 0;
			this.chbWordWrap.Text = "Word Wrap";
			this.chbHighlightUrls.FlatStyle = FlatStyle.System;
			this.chbHighlightUrls.Location = new Point(8, 41);
			this.chbHighlightUrls.Name = "chbHighlightUrls";
			this.chbHighlightUrls.Size = new Size(128, 25);
			this.chbHighlightUrls.TabIndex = 1;
			this.chbHighlightUrls.Text = "Highlight Urls";
			this.tpAdditional.Controls.Add(this.pnAdditional);
			this.tpAdditional.Location = new Point(4, 22);
			this.tpAdditional.Name = "tpAdditional";
			this.tpAdditional.Size = new Size(408, 334);
			this.tpAdditional.TabIndex = 2;
			this.tpAdditional.Text = "Additional";
			this.pnAdditional.Controls.Add(this.gbTabOptions);
			this.pnAdditional.Controls.Add(this.gbOutlineOptions);
			this.pnAdditional.Controls.Add(this.gbNavigateOptions);
			this.pnAdditional.Location = new Point(0, 0);
			this.pnAdditional.Name = "pnAdditional";
			this.pnAdditional.Size = new Size(400, 296);
			this.pnAdditional.TabIndex = 8;
			this.pnAdditional.Visible = false;
			this.gbTabOptions.Controls.Add(this.tbTabStops);
			this.gbTabOptions.Controls.Add(this.rbKeepTabs);
			this.gbTabOptions.Controls.Add(this.rbInsertSpaces);
			this.gbTabOptions.Controls.Add(this.laTabSizes);
			this.gbTabOptions.FlatStyle = FlatStyle.System;
			this.gbTabOptions.Location = new Point(8, 200);
			this.gbTabOptions.Name = "gbTabOptions";
			this.gbTabOptions.Size = new Size(384, 72);
			this.gbTabOptions.TabIndex = 40;
			this.gbTabOptions.TabStop = false;
			this.gbTabOptions.Text = "Tab Options";
			this.tbTabStops.Location = new Point(8, 40);
			this.tbTabStops.Name = "tbTabStops";
			this.tbTabStops.Size = new Size(120, 20);
			this.tbTabStops.TabIndex = 5;
			this.rbKeepTabs.FlatStyle = FlatStyle.System;
			this.rbKeepTabs.Location = new Point(160, 41);
			this.rbKeepTabs.Name = "rbKeepTabs";
			this.rbKeepTabs.Size = new Size(184, 25);
			this.rbKeepTabs.TabIndex = 4;
			this.rbKeepTabs.Text = "&Keep tabs";
			this.rbInsertSpaces.FlatStyle = FlatStyle.System;
			this.rbInsertSpaces.Location = new Point(160, 16);
			this.rbInsertSpaces.Name = "rbInsertSpaces";
			this.rbInsertSpaces.Size = new Size(184, 25);
			this.rbInsertSpaces.TabIndex = 3;
			this.rbInsertSpaces.Text = "Insert s&paces";
			this.laTabSizes.AutoSize = true;
			this.laTabSizes.FlatStyle = FlatStyle.System;
			this.laTabSizes.Location = new Point(8, 21);
			this.laTabSizes.Name = "laTabSizes";
			this.laTabSizes.Size = new Size(57, 13);
			this.laTabSizes.TabIndex = 0;
			this.laTabSizes.Text = "Tab Sizes:";
			this.gbOutlineOptions.Controls.Add(this.chbAllowOutlining);
			this.gbOutlineOptions.Controls.Add(this.chbShowHints);
			this.gbOutlineOptions.FlatStyle = FlatStyle.System;
			this.gbOutlineOptions.Location = new Point(8, 116);
			this.gbOutlineOptions.Name = "gbOutlineOptions";
			this.gbOutlineOptions.Size = new Size(384, 72);
			this.gbOutlineOptions.TabIndex = 39;
			this.gbOutlineOptions.TabStop = false;
			this.gbOutlineOptions.Text = "Outline Options";
			this.chbAllowOutlining.FlatStyle = FlatStyle.System;
			this.chbAllowOutlining.Location = new Point(8, 16);
			this.chbAllowOutlining.Name = "chbAllowOutlining";
			this.chbAllowOutlining.Size = new Size(336, 25);
			this.chbAllowOutlining.TabIndex = 0;
			this.chbAllowOutlining.Text = "Allow outlining";
			this.chbShowHints.FlatStyle = FlatStyle.System;
			this.chbShowHints.Location = new Point(8, 41);
			this.chbShowHints.Name = "chbShowHints";
			this.chbShowHints.Size = new Size(336, 25);
			this.chbShowHints.TabIndex = 1;
			this.chbShowHints.Text = "Show Hints";
			this.gbNavigateOptions.Controls.Add(this.chbMoveOnRightButton);
			this.gbNavigateOptions.Controls.Add(this.chbBeyondEof);
			this.gbNavigateOptions.Controls.Add(this.chbBeyondEol);
			this.gbNavigateOptions.FlatStyle = FlatStyle.System;
			this.gbNavigateOptions.Location = new Point(8, 8);
			this.gbNavigateOptions.Name = "gbNavigateOptions";
			this.gbNavigateOptions.Size = new Size(384, 98);
			this.gbNavigateOptions.TabIndex = 38;
			this.gbNavigateOptions.TabStop = false;
			this.gbNavigateOptions.Text = "Navigate Options";
			this.chbMoveOnRightButton.FlatStyle = FlatStyle.System;
			this.chbMoveOnRightButton.Location = new Point(8, 66);
			this.chbMoveOnRightButton.Name = "chbMoveOnRightButton";
			this.chbMoveOnRightButton.Size = new Size(336, 25);
			this.chbMoveOnRightButton.TabIndex = 14;
			this.chbMoveOnRightButton.Text = "Move on Right Button";
			this.chbBeyondEof.FlatStyle = FlatStyle.System;
			this.chbBeyondEof.Location = new Point(8, 41);
			this.chbBeyondEof.Name = "chbBeyondEof";
			this.chbBeyondEof.Size = new Size(336, 25);
			this.chbBeyondEof.TabIndex = 13;
			this.chbBeyondEof.Text = "Beyond Eof";
			this.chbBeyondEol.FlatStyle = FlatStyle.System;
			this.chbBeyondEol.Location = new Point(8, 16);
			this.chbBeyondEol.Name = "chbBeyondEol";
			this.chbBeyondEol.Size = new Size(336, 25);
			this.chbBeyondEol.TabIndex = 12;
			this.chbBeyondEol.Text = "Beyond Eol";
			this.tpFontsAndColors.Controls.Add(this.pnFontsColors);
			this.tpFontsAndColors.Location = new Point(4, 22);
			this.tpFontsAndColors.Name = "tpFontsAndColors";
			this.tpFontsAndColors.Size = new Size(408, 334);
			this.tpFontsAndColors.TabIndex = 1;
			this.tpFontsAndColors.Text = "Fonts&&Colors";
			this.pnFontsColors.Controls.Add(this.cbForeColor);
			this.pnFontsColors.Controls.Add(this.cbBackColor);
			this.pnFontsColors.Controls.Add(this.gbColorThemes);
			this.pnFontsColors.Controls.Add(this.tbFontSize);
			this.pnFontsColors.Controls.Add(this.laDisplayItems);
			this.pnFontsColors.Controls.Add(this.pnSampleText);
			this.pnFontsColors.Controls.Add(this.laSample);
			this.pnFontsColors.Controls.Add(this.laSize);
			this.pnFontsColors.Controls.Add(this.laFont);
			this.pnFontsColors.Controls.Add(this.cbFontName);
			this.pnFontsColors.Controls.Add(this.laDescription);
			this.pnFontsColors.Controls.Add(this.tbDescription);
			this.pnFontsColors.Controls.Add(this.laBackColor);
			this.pnFontsColors.Controls.Add(this.laForeColor);
			this.pnFontsColors.Controls.Add(this.lbStyles);
			this.pnFontsColors.Controls.Add(this.gbFontAttributes);
			this.pnFontsColors.Location = new Point(0, 0);
			this.pnFontsColors.Name = "pnFontsColors";
			this.pnFontsColors.Size = new Size(400, 328);
			this.pnFontsColors.TabIndex = 7;
			this.pnFontsColors.Visible = false;
			this.cbForeColor.DrawMode = DrawMode.OwnerDrawFixed;
			this.cbForeColor.Location = new Point(152, 216);
			this.cbForeColor.Name = "cbForeColor";
			this.cbForeColor.SelectedColor = Color.Empty;
			this.cbForeColor.Size = new Size(120, 21);
			this.cbForeColor.TabIndex = 17;
			this.cbForeColor.SelectedIndexChanged += new EventHandler(this.cbForeColor_SelectedIndexChanged);
			this.cbBackColor.DrawMode = DrawMode.OwnerDrawFixed;
			this.cbBackColor.Location = new Point(152, 264);
			this.cbBackColor.Name = "cbBackColor";
			this.cbBackColor.SelectedColor = Color.Empty;
			this.cbBackColor.Size = new Size(120, 21);
			this.cbBackColor.TabIndex = 18;
			this.cbBackColor.SelectedIndexChanged += new EventHandler(this.cbBackColor_SelectedIndexChanged);
			this.gbColorThemes.Controls.Add(this.btDeleteColorTheme);
			this.gbColorThemes.Controls.Add(this.btAddColorTheme);
			this.gbColorThemes.Controls.Add(this.cbColorThemes);
			this.gbColorThemes.Location = new Point(8, 8);
			this.gbColorThemes.Name = "gbColorThemes";
			this.gbColorThemes.Size = new Size(392, 85);
			this.gbColorThemes.TabIndex = 20;
			this.gbColorThemes.TabStop = false;
			this.gbColorThemes.Text = "Color Themes";
			this.btDeleteColorTheme.Location = new Point(237, 56);
			this.btDeleteColorTheme.Name = "btDeleteColorTheme";
			this.btDeleteColorTheme.Size = new Size(147, 23);
			this.btDeleteColorTheme.TabIndex = 2;
			this.btDeleteColorTheme.Text = "&Delete Color Theme";
			this.btDeleteColorTheme.Click += new EventHandler(this.btDeleteColorTheme_Click);
			this.btAddColorTheme.Location = new Point(237, 17);
			this.btAddColorTheme.Name = "btAddColorTheme";
			this.btAddColorTheme.Size = new Size(147, 23);
			this.btAddColorTheme.TabIndex = 1;
			this.btAddColorTheme.Text = "&Add Color Theme";
			this.btAddColorTheme.Click += new EventHandler(this.btAddColorTheme_Click);
			this.cbColorThemes.Location = new Point(10, 19);
			this.cbColorThemes.Name = "cbColorThemes";
			this.cbColorThemes.Size = new Size(215, 21);
			this.cbColorThemes.TabIndex = 0;
			this.cbColorThemes.SelectedIndexChanged += new EventHandler(this.cbColorThemes_SelectedIndexChanged);
			this.cbColorThemes.Leave += new EventHandler(this.cbColorThemes_Leave);
			this.tbFontSize.Location = new Point(152, 112);
			this.tbFontSize.Name = "tbFontSize";
			this.tbFontSize.Size = new Size(32, 20);
			this.tbFontSize.TabIndex = 19;
			this.tbFontSize.Text = "1";
			this.tbFontSize.Leave += new EventHandler(this.tbFontSize_Leave);
			this.laDisplayItems.AutoSize = true;
			this.laDisplayItems.FlatStyle = FlatStyle.System;
			this.laDisplayItems.Location = new Point(8, 144);
			this.laDisplayItems.Name = "laDisplayItems";
			this.laDisplayItems.Size = new Size(71, 13);
			this.laDisplayItems.TabIndex = 4;
			this.laDisplayItems.Text = "&Display items:";
			this.pnSampleText.BorderStyle = BorderStyle.FixedSingle;
			this.pnSampleText.Controls.Add(this.laSampleText);
			this.pnSampleText.Location = new Point(8, 305);
			this.pnSampleText.Name = "pnSampleText";
			this.pnSampleText.Size = new Size(384, 48);
			this.pnSampleText.TabIndex = 14;
			this.laSampleText.AutoSize = true;
			this.laSampleText.Location = new Point(160, 16);
			this.laSampleText.Name = "laSampleText";
			this.laSampleText.Size = new Size(57, 13);
			this.laSampleText.TabIndex = 0;
			this.laSampleText.Text = "AaBbYyZz";
			this.laSample.AutoSize = true;
			this.laSample.FlatStyle = FlatStyle.System;
			this.laSample.Location = new Point(8, 289);
			this.laSample.Name = "laSample";
			this.laSample.Size = new Size(45, 13);
			this.laSample.TabIndex = 13;
			this.laSample.Text = "Sample:";
			this.laSize.AutoSize = true;
			this.laSize.FlatStyle = FlatStyle.System;
			this.laSize.Location = new Point(152, 96);
			this.laSize.Name = "laSize";
			this.laSize.Size = new Size(30, 13);
			this.laSize.TabIndex = 2;
			this.laSize.Text = "&Size:";
			this.laFont.AutoSize = true;
			this.laFont.FlatStyle = FlatStyle.System;
			this.laFont.Location = new Point(8, 96);
			this.laFont.Name = "laFont";
			this.laFont.Size = new Size(31, 13);
			this.laFont.TabIndex = 0;
			this.laFont.Text = "Font:";
			this.cbFontName.Location = new Point(8, 112);
			this.cbFontName.Name = "cbFontName";
			this.cbFontName.Size = new Size(121, 21);
			this.cbFontName.TabIndex = 1;
			this.cbFontName.SelectedIndexChanged += new EventHandler(this.cbFontName_SelectedIndexChanged);
			this.laDescription.AutoSize = true;
			this.laDescription.FlatStyle = FlatStyle.System;
			this.laDescription.Location = new Point(152, 144);
			this.laDescription.Name = "laDescription";
			this.laDescription.Size = new Size(63, 13);
			this.laDescription.TabIndex = 6;
			this.laDescription.Text = "Description:";
			this.tbDescription.Location = new Point(152, 160);
			this.tbDescription.Name = "tbDescription";
			this.tbDescription.Size = new Size(240, 20);
			this.tbDescription.TabIndex = 7;
			this.laBackColor.AutoSize = true;
			this.laBackColor.FlatStyle = FlatStyle.System;
			this.laBackColor.Location = new Point(152, 240);
			this.laBackColor.Name = "laBackColor";
			this.laBackColor.Size = new Size(62, 13);
			this.laBackColor.TabIndex = 10;
			this.laBackColor.Text = "Back Color:";
			this.laForeColor.AutoSize = true;
			this.laForeColor.FlatStyle = FlatStyle.System;
			this.laForeColor.Location = new Point(152, 192);
			this.laForeColor.Name = "laForeColor";
			this.laForeColor.Size = new Size(58, 13);
			this.laForeColor.TabIndex = 8;
			this.laForeColor.Text = "Fore Color:";
			this.lbStyles.Location = new Point(8, 160);
			this.lbStyles.Name = "lbStyles";
			this.lbStyles.Size = new Size(120, 121);
			this.lbStyles.TabIndex = 5;
			this.gbFontAttributes.Controls.Add(this.chbUnderline);
			this.gbFontAttributes.Controls.Add(this.chbItalic);
			this.gbFontAttributes.Controls.Add(this.chbBold);
			this.gbFontAttributes.FlatStyle = FlatStyle.System;
			this.gbFontAttributes.Location = new Point(280, 192);
			this.gbFontAttributes.Name = "gbFontAttributes";
			this.gbFontAttributes.Size = new Size(112, 92);
			this.gbFontAttributes.TabIndex = 12;
			this.gbFontAttributes.TabStop = false;
			this.gbFontAttributes.Text = "Attributes:";
			this.chbUnderline.FlatStyle = FlatStyle.System;
			this.chbUnderline.Location = new Point(8, 64);
			this.chbUnderline.Name = "chbUnderline";
			this.chbUnderline.Size = new Size(100, 24);
			this.chbUnderline.TabIndex = 2;
			this.chbUnderline.Text = "Underline";
			this.chbItalic.FlatStyle = FlatStyle.System;
			this.chbItalic.Location = new Point(8, 40);
			this.chbItalic.Name = "chbItalic";
			this.chbItalic.Size = new Size(100, 24);
			this.chbItalic.TabIndex = 1;
			this.chbItalic.Text = "Italic";
			this.chbBold.FlatStyle = FlatStyle.System;
			this.chbBold.Location = new Point(8, 16);
			this.chbBold.Name = "chbBold";
			this.chbBold.Size = new Size(100, 24);
			this.chbBold.TabIndex = 0;
			this.chbBold.Text = "Bold";
			this.tpKeyboard.Controls.Add(this.pnKeyboard);
			this.tpKeyboard.Location = new Point(4, 22);
			this.tpKeyboard.Name = "tpKeyboard";
			this.tpKeyboard.Size = new Size(408, 334);
			this.tpKeyboard.TabIndex = 3;
			this.tpKeyboard.Text = "Keyboard";
			this.pnKeyboard.Controls.Add(this.cbShortcuts);
			this.pnKeyboard.Controls.Add(this.laShortcuts);
			this.pnKeyboard.Controls.Add(this.lbEventHandlers);
			this.pnKeyboard.Controls.Add(this.tbShowCommands);
			this.pnKeyboard.Controls.Add(this.laShowCommands);
			this.pnKeyboard.Controls.Add(this.btDeleteScheme);
			this.pnKeyboard.Controls.Add(this.btSaveSchemeAs);
			this.pnKeyboard.Controls.Add(this.cbKeyboardSchemes);
			this.pnKeyboard.Controls.Add(this.laKeyboardMappingScheme);
			this.pnKeyboard.Location = new Point(0, 0);
			this.pnKeyboard.Name = "pnKeyboard";
			this.pnKeyboard.Size = new Size(400, 331);
			this.pnKeyboard.TabIndex = 0;
			this.pnKeyboard.Visible = false;
			this.cbShortcuts.Location = new Point(8, 291);
			this.cbShortcuts.Name = "cbShortcuts";
			this.cbShortcuts.Size = new Size(304, 21);
			this.cbShortcuts.TabIndex = 8;
			this.laShortcuts.AutoSize = true;
			this.laShortcuts.Location = new Point(8, 275);
			this.laShortcuts.Name = "laShortcuts";
			this.laShortcuts.Size = new Size(168, 13);
			this.laShortcuts.TabIndex = 7;
			this.laShortcuts.Text = "Shor&tcut(s) for selected command:";
			this.lbEventHandlers.Location = new Point(8, 88);
			this.lbEventHandlers.Name = "lbEventHandlers";
			this.lbEventHandlers.Size = new Size(384, 173);
			this.lbEventHandlers.TabIndex = 6;
			this.lbEventHandlers.SelectedIndexChanged += new EventHandler(this.lbEventHandlers_SelectedIndexChanged);
			this.tbShowCommands.Location = new Point(8, 64);
			this.tbShowCommands.Name = "tbShowCommands";
			this.tbShowCommands.Size = new Size(384, 20);
			this.tbShowCommands.TabIndex = 5;
			this.tbShowCommands.TextChanged += new EventHandler(this.tbShowCommands_TextChanged);
			this.laShowCommands.AutoSize = true;
			this.laShowCommands.Location = new Point(8, 48);
			this.laShowCommands.Name = "laShowCommands";
			this.laShowCommands.Size = new Size(143, 13);
			this.laShowCommands.TabIndex = 4;
			this.laShowCommands.Text = "Show &commands containing:";
			this.btDeleteScheme.Enabled = false;
			this.btDeleteScheme.Location = new Point(318, 22);
			this.btDeleteScheme.Name = "btDeleteScheme";
			this.btDeleteScheme.Size = new Size(75, 23);
			this.btDeleteScheme.TabIndex = 3;
			this.btDeleteScheme.Text = "&Delete";
			this.btSaveSchemeAs.Enabled = false;
			this.btSaveSchemeAs.Location = new Point(208, 22);
			this.btSaveSchemeAs.Name = "btSaveSchemeAs";
			this.btSaveSchemeAs.Size = new Size(104, 23);
			this.btSaveSchemeAs.TabIndex = 2;
			this.btSaveSchemeAs.Text = "&Save As...";
			this.cbKeyboardSchemes.Location = new Point(8, 24);
			this.cbKeyboardSchemes.Name = "cbKeyboardSchemes";
			this.cbKeyboardSchemes.Size = new Size(192, 21);
			this.cbKeyboardSchemes.TabIndex = 1;
			this.laKeyboardMappingScheme.AutoSize = true;
			this.laKeyboardMappingScheme.Location = new Point(8, 8);
			this.laKeyboardMappingScheme.Name = "laKeyboardMappingScheme";
			this.laKeyboardMappingScheme.Size = new Size(138, 13);
			this.laKeyboardMappingScheme.TabIndex = 0;
			this.laKeyboardMappingScheme.Text = "Keyboard &mapping scheme:";
			this.pnTree.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
			this.pnTree.Controls.Add(this.tvProperties);
			this.pnTree.Location = new Point(0, 0);
			this.pnTree.Name = "pnTree";
			this.pnTree.Size = new Size(136, 360);
			this.pnTree.TabIndex = 0;
			this.tvProperties.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.tvProperties.ImageIndex = 3;
			this.tvProperties.ImageList = this.imageList1;
			this.tvProperties.Location = new Point(0, 0);
			this.tvProperties.Name = "tvProperties";
			treeNode.Name = "";
			treeNode.Text = "General";
			treeNode2.Name = "";
			treeNode2.Text = "Fonts and Colors";
			treeNode3.Name = "";
			treeNode3.Text = "Additional";
			treeNode4.Name = "";
			treeNode4.Text = "Keyboard";
			treeNode5.ImageIndex = 1;
			treeNode5.Name = "";
			treeNode5.SelectedImageIndex = 0;
			treeNode5.Text = "Options";
			this.tvProperties.Nodes.AddRange(new TreeNode[]
			{
				treeNode5
			});
			this.tvProperties.Scrollable = false;
			this.tvProperties.SelectedImageIndex = 2;
			this.tvProperties.ShowLines = false;
			this.tvProperties.ShowPlusMinus = false;
			this.tvProperties.ShowRootLines = false;
			this.tvProperties.Size = new Size(136, 360);
			this.tvProperties.TabIndex = 0;
			this.tvProperties.AfterSelect += new TreeViewEventHandler(this.tvProperties_AfterSelect);
			this.imageList1.ImageStream = (ImageListStreamer)componentResourceManager.GetObject("imageList1.ImageStream");
			this.imageList1.TransparentColor = Color.Red;
			this.imageList1.Images.SetKeyName(0, "");
			this.imageList1.Images.SetKeyName(1, "");
			this.imageList1.Images.SetKeyName(2, "");
			this.imageList1.Images.SetKeyName(3, "");
			base.AcceptButton = this.btOK;
			this.AutoScaleBaseSize = new Size(5, 13);
			base.CancelButton = this.btCancel;
			base.ClientSize = new Size(552, 398);
			base.Controls.Add(this.pnMain);
			base.Controls.Add(this.pnButtons);
			base.FormBorderStyle = FormBorderStyle.FixedDialog;
			base.MaximizeBox = false;
			base.MinimizeBox = false;
			base.Name = "DlgSyntaxSettings";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "Syntax Settings";
			base.Load += new EventHandler(this.DlgSyntaxSettings_Load);
			base.Activated += new EventHandler(this.DlgSyntaxSettings_Activated);
			this.pnButtons.ResumeLayout(false);
			this.pnMain.ResumeLayout(false);
			this.pnManage.ResumeLayout(false);
			this.tcMain.ResumeLayout(false);
			this.tpGeneral.ResumeLayout(false);
			this.pnGeneral.ResumeLayout(false);
			this.gbLineNumbers.ResumeLayout(false);
			this.gbGutterMargin.ResumeLayout(false);
			this.gbGutterMargin.PerformLayout();
			this.gbDocument.ResumeLayout(false);
			this.tpAdditional.ResumeLayout(false);
			this.pnAdditional.ResumeLayout(false);
			this.gbTabOptions.ResumeLayout(false);
			this.gbTabOptions.PerformLayout();
			this.gbOutlineOptions.ResumeLayout(false);
			this.gbNavigateOptions.ResumeLayout(false);
			this.tpFontsAndColors.ResumeLayout(false);
			this.pnFontsColors.ResumeLayout(false);
			this.pnFontsColors.PerformLayout();
			this.gbColorThemes.ResumeLayout(false);
			this.pnSampleText.ResumeLayout(false);
			this.pnSampleText.PerformLayout();
			this.gbFontAttributes.ResumeLayout(false);
			this.tpKeyboard.ResumeLayout(false);
			this.pnKeyboard.ResumeLayout(false);
			this.pnKeyboard.PerformLayout();
			this.pnTree.ResumeLayout(false);
			base.ResumeLayout(false);
		}
		private void UpdateHiddenTabs(EditorSettingsTab hiddenTabs)
		{
			if ((hiddenTabs & EditorSettingsTab.General) != EditorSettingsTab.None)
			{
				this.rootNode.Nodes.Remove(this.generalNode);
			}
			if ((hiddenTabs & EditorSettingsTab.FontsAndColors) != EditorSettingsTab.None)
			{
				this.rootNode.Nodes.Remove(this.fontsNode);
			}
			if ((hiddenTabs & EditorSettingsTab.Additional) != EditorSettingsTab.None)
			{
				this.rootNode.Nodes.Remove(this.additionalNode);
			}
			if ((hiddenTabs & EditorSettingsTab.Keymapping) != EditorSettingsTab.None)
			{
				this.rootNode.Nodes.Remove(this.keyboardNode);
			}
		}
		private string[] GetFonts()
		{
			FontFamily[] families = FontFamily.Families;
			string[] array = new string[families.Length];
			for (int i = 0; i < families.Length; i++)
			{
				array[i] = families[i].Name;
			}
			return array;
		}
		private int GetInt(string s, int DefaultValue)
		{
			int result;
			try
			{
				result = int.Parse(s);
			}
			catch
			{
				result = DefaultValue;
			}
			return result;
		}
		private void FillEventHandlers()
		{
			this.UpdateEventHandlers();
		}
		private void UpdateEventHandlers()
		{
			this.lbEventHandlers.BeginUpdate();
			try
			{
				this.lbEventHandlers.Sorted = false;
				this.lbEventHandlers.Items.Clear();
				KeyData[] eventData = this.syntaxSettings.EventData;
				for (int i = 0; i < eventData.Length; i++)
				{
					KeyData keyData = eventData[i];
					string text = (keyData.Param != null) ? string.Format("{0}{1}", keyData.EventName, keyData.Param.ToString()) : keyData.EventName;
					if (text != string.Empty)
					{
						if (this.tbShowCommands.Text != string.Empty)
						{
							if (text.IndexOf(this.tbShowCommands.Text) >= 0 && this.lbEventHandlers.Items.IndexOf(text) < 0)
							{
								this.lbEventHandlers.Items.Add(text);
							}
						}
						else
						{
							if (this.lbEventHandlers.Items.IndexOf(text) < 0)
							{
								this.lbEventHandlers.Items.Add(text);
							}
						}
					}
				}
				this.lbEventHandlers.Sorted = true;
				if (this.lbEventHandlers.Items.Count > 0)
				{
					this.lbEventHandlers.SelectedIndex = 0;
				}
			}
			finally
			{
				this.lbEventHandlers.EndUpdate();
			}
		}
		private void UpdateShortcut(int index)
		{
			this.cbShortcuts.Text = string.Empty;
			this.cbShortcuts.Items.Clear();
			string text = this.lbEventHandlers.Items[index].ToString();
			KeyData[] eventData = this.syntaxSettings.EventData;
			for (int i = 0; i < eventData.Length; i++)
			{
				KeyData keyData = eventData[i];
				if (keyData.EventName != string.Empty && text.StartsWith(keyData.EventName))
				{
					string b = (text.Length > keyData.EventName.Length) ? text.Remove(0, keyData.EventName.Length) : string.Empty;
					if (keyData.Param == null || keyData.Param.ToString() == b)
					{
						string text2 = this.ApplyKeyState(keyData);
						string item = (text2 != string.Empty) ? string.Format("{0}, {1}", text2, this.KeyDataToString(keyData.Keys)) : this.KeyDataToString(keyData.Keys);
						this.cbShortcuts.Items.Add(item);
					}
				}
			}
			if (this.cbShortcuts.Items.Count > 0)
			{
				this.cbShortcuts.SelectedIndex = 0;
			}
		}
		private string KeyDataToString(Keys keyData)
		{
			string text = keyData.ToString();
			string[] array = text.Split(new char[]
			{
				','
			});
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			text = string.Empty;
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].IndexOf(this.sControl, StringComparison.OrdinalIgnoreCase) >= 0)
				{
					flag = true;
				}
				else
				{
					if (array[i].IndexOf(this.sAlt, StringComparison.OrdinalIgnoreCase) >= 0)
					{
						flag2 = true;
					}
					else
					{
						if (array[i].IndexOf(this.sShift, StringComparison.OrdinalIgnoreCase) >= 0)
						{
							flag3 = true;
						}
						else
						{
							text = ((text != string.Empty) ? string.Format("{0} + {1}", text, array[i]) : array[i]);
						}
					}
				}
			}
			if (flag2)
			{
				text = ((text != string.Empty) ? string.Format("{0} + {1}", this.sAlt.ToUpper(), text) : this.sAlt.ToUpper());
			}
			if (flag3)
			{
				text = ((text != string.Empty) ? string.Format("{0} + {1}", this.sShift.ToUpper(), text) : this.sShift.ToUpper());
			}
			if (flag)
			{
				text = ((text != string.Empty) ? string.Format("{0} + {1}", this.sCtrl, text) : this.sCtrl);
			}
			return text;
		}
		private string ApplyKeyState(KeyData key)
		{
			string result = string.Empty;
			if (key.State > 0)
			{
				KeyData[] eventData = this.syntaxSettings.EventData;
				KeyData[] array = eventData;
				for (int i = 0; i < array.Length; i++)
				{
					KeyData keyData = array[i];
					if (keyData.LeaveState == key.State && keyData.State == 0)
					{
						result = this.KeyDataToString(keyData.Keys);
						break;
					}
				}
			}
			return result;
		}
		private void ControlsFromSettings()
		{
			this.FillStyles();
			this.FillColorThemes();
			this.cbFontName.Items.AddRange(this.GetFonts());
			this.cbKeyboardSchemes.Items.Clear();
			this.cbKeyboardSchemes.Items.Add("Default Settings");
			this.cbKeyboardSchemes.SelectedIndex = 0;
			this.FillEventHandlers();
			this.chbDragAndDrop.Checked = ((this.syntaxSettings.SelectionOptions & SelectionOptions.DisableDragging) == SelectionOptions.None);
			RichTextBoxScrollBars scrollBars = this.syntaxSettings.ScrollBars;
			switch (scrollBars)
			{
			case RichTextBoxScrollBars.None:
				this.chbVertScrollBar.Checked = false;
				this.chbHorzScrollBar.Checked = false;
				this.chbForced.Checked = false;
				goto IL_18E;
			case RichTextBoxScrollBars.Horizontal:
				break;
			case RichTextBoxScrollBars.Vertical:
				goto IL_13A;
			case RichTextBoxScrollBars.Both:
				this.chbVertScrollBar.Checked = true;
				this.chbHorzScrollBar.Checked = true;
				this.chbForced.Checked = false;
				goto IL_18E;
			default:
				switch (scrollBars)
				{
				case RichTextBoxScrollBars.ForcedHorizontal:
					break;
				case RichTextBoxScrollBars.ForcedVertical:
					goto IL_13A;
				case RichTextBoxScrollBars.ForcedBoth:
					this.chbVertScrollBar.Checked = true;
					this.chbHorzScrollBar.Checked = true;
					this.chbForced.Checked = true;
					goto IL_18E;
				default:
					goto IL_18E;
				}
				break;
			}
			this.chbVertScrollBar.Checked = false;
			this.chbHorzScrollBar.Checked = true;
			this.chbForced.Checked = false;
			goto IL_18E;
			IL_13A:
			this.chbVertScrollBar.Checked = true;
			this.chbHorzScrollBar.Checked = false;
			this.chbForced.Checked = false;
			IL_18E:
			this.chbShowMargin.Checked = this.syntaxSettings.ShowMargin;
			this.chbWordWrap.Checked = this.syntaxSettings.WordWrap;
			this.chbLineNumbers.Checked = ((this.syntaxSettings.GutterOptions & GutterOptions.PaintLineNumbers) != GutterOptions.None);
			this.chbLineNumbersOnGutter.Checked = ((this.syntaxSettings.GutterOptions & GutterOptions.PaintLinesOnGutter) != GutterOptions.None);
			this.chbShowGutter.Checked = this.syntaxSettings.ShowGutter;
			this.tbGutterWidth.Text = this.syntaxSettings.GutterWidth.ToString();
			this.tbMarginPosition.Text = this.syntaxSettings.MarginPos.ToString();
			this.chbBeyondEol.Checked = ((this.syntaxSettings.NavigateOptions & NavigateOptions.BeyondEol) != NavigateOptions.None);
			this.chbBeyondEof.Checked = ((this.syntaxSettings.NavigateOptions & NavigateOptions.BeyondEof) != NavigateOptions.None);
			this.chbMoveOnRightButton.Checked = ((this.syntaxSettings.NavigateOptions & NavigateOptions.MoveOnRightButton) != NavigateOptions.None);
			this.chbHighlightUrls.Checked = this.syntaxSettings.HighlightHyperText;
			this.chbAllowOutlining.Checked = this.syntaxSettings.AllowOutlining;
			this.chbShowHints.Checked = ((this.syntaxSettings.OutlineOptions & OutlineOptions.ShowHints) != OutlineOptions.None);
			this.rbInsertSpaces.Checked = this.syntaxSettings.UseSpaces;
			this.rbKeepTabs.Checked = !this.syntaxSettings.UseSpaces;
			this.chbWhiteSpace.Checked = this.syntaxSettings.WhiteSpaceVisible;
			this.chbLineModificator.Checked = ((this.syntaxSettings.GutterOptions & GutterOptions.PaintLineModificators) != GutterOptions.None);
			string[] array = new string[this.syntaxSettings.TabStops.Length];
			for (int i = 0; i < this.syntaxSettings.TabStops.Length; i++)
			{
				array[i] = this.syntaxSettings.TabStops[i].ToString();
			}
			this.tbTabStops.Text = string.Join(",", array);
			this.UpdateFontControls();
		}
		private void UpdateFontControls()
		{
			try
			{
				this.isFontControlsUpdating = true;
				this.cbFontName.SelectedIndex = this.cbFontName.Items.IndexOf(this.syntaxSettings.Font.Name);
				this.tbFontSize.Text = this.syntaxSettings.Font.Size.ToString();
			}
			finally
			{
				this.isFontControlsUpdating = false;
			}
			this.FontNameChanged(this, new EventArgs());
			this.OnStyleSelected(this, new EventArgs());
		}
		private void SettingsFromControl()
		{
			bool @checked = this.chbVertScrollBar.Checked;
			bool checked2 = this.chbHorzScrollBar.Checked;
			bool checked3 = this.chbForced.Checked;
			if (checked2)
			{
				if (@checked)
				{
					this.syntaxSettings.ScrollBars = (checked3 ? RichTextBoxScrollBars.ForcedBoth : RichTextBoxScrollBars.Both);
				}
				else
				{
					this.syntaxSettings.ScrollBars = (checked3 ? RichTextBoxScrollBars.ForcedHorizontal : RichTextBoxScrollBars.Horizontal);
				}
			}
			else
			{
				if (@checked)
				{
					this.syntaxSettings.ScrollBars = (checked3 ? RichTextBoxScrollBars.ForcedVertical : RichTextBoxScrollBars.Vertical);
				}
				else
				{
					this.syntaxSettings.ScrollBars = RichTextBoxScrollBars.None;
				}
			}
			if (this.chbDragAndDrop.Checked)
			{
				this.syntaxSettings.SelectionOptions = (this.syntaxSettings.SelectionOptions & ~SelectionOptions.DisableDragging);
			}
			else
			{
				this.syntaxSettings.SelectionOptions = (this.syntaxSettings.SelectionOptions | SelectionOptions.DisableDragging);
			}
			this.syntaxSettings.ShowMargin = this.chbShowMargin.Checked;
			this.syntaxSettings.WordWrap = this.chbWordWrap.Checked;
			this.syntaxSettings.WhiteSpaceVisible = this.chbWhiteSpace.Checked;
			this.syntaxSettings.ShowGutter = this.chbShowGutter.Checked;
			this.syntaxSettings.GutterWidth = this.GetInt(this.tbGutterWidth.Text, EditConsts.DefaultGutterWidth);
			this.syntaxSettings.MarginPos = this.GetInt(this.tbMarginPosition.Text, EditConsts.DefaultMarginPosition);
			if (this.chbLineNumbers.Checked)
			{
				this.syntaxSettings.GutterOptions |= GutterOptions.PaintLineNumbers;
			}
			else
			{
				this.syntaxSettings.GutterOptions &= ~GutterOptions.PaintLineNumbers;
			}
			if (this.chbLineNumbersOnGutter.Checked)
			{
				this.syntaxSettings.GutterOptions |= GutterOptions.PaintLinesOnGutter;
			}
			else
			{
				this.syntaxSettings.GutterOptions &= ~GutterOptions.PaintLinesOnGutter;
			}
			if (this.chbLineModificator.Checked)
			{
				this.syntaxSettings.GutterOptions |= GutterOptions.PaintLineModificators;
			}
			else
			{
				this.syntaxSettings.GutterOptions &= ~GutterOptions.PaintLineModificators;
			}
			if (this.chbBeyondEol.Checked)
			{
				this.syntaxSettings.NavigateOptions |= NavigateOptions.BeyondEol;
			}
			else
			{
				this.syntaxSettings.NavigateOptions &= ~NavigateOptions.BeyondEol;
			}
			if (this.chbBeyondEof.Checked)
			{
				this.syntaxSettings.NavigateOptions |= NavigateOptions.BeyondEof;
			}
			else
			{
				this.syntaxSettings.NavigateOptions &= ~NavigateOptions.BeyondEof;
			}
			if (this.chbMoveOnRightButton.Checked)
			{
				this.syntaxSettings.NavigateOptions |= NavigateOptions.MoveOnRightButton;
			}
			else
			{
				this.syntaxSettings.NavigateOptions &= ~NavigateOptions.MoveOnRightButton;
			}
			if (this.chbShowHints.Checked)
			{
				this.syntaxSettings.OutlineOptions |= OutlineOptions.ShowHints;
			}
			else
			{
				this.syntaxSettings.OutlineOptions &= ~OutlineOptions.ShowHints;
			}
			this.syntaxSettings.HighlightHyperText = this.chbHighlightUrls.Checked;
			this.syntaxSettings.AllowOutlining = this.chbAllowOutlining.Checked;
			this.syntaxSettings.UseSpaces = this.rbInsertSpaces.Checked;
			string[] array = this.tbTabStops.Text.Split(new char[]
			{
				','
			});
			int[] array2 = new int[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				int @int = this.GetInt(array[i], EditConsts.DefaultTabStop);
				array2[i] = ((@int <= 0) ? EditConsts.DefaultTabStop : @int);
			}
			this.syntaxSettings.TabStops = array2;
			this.syntaxSettings.Font = new Font(this.syntaxSettings.Font.Name, (float)Math.Max(Math.Min(this.GetInt(this.tbFontSize.Text, 10), EditConsts.MaxFontSize), 1), this.syntaxSettings.Font.Style);
		}
		private void FillStyles()
		{
			this.lbStyles.Items.Clear();
			for (int i = 0; i < this.syntaxSettings.LexStyles.Count; i++)
			{
				this.lbStyles.Items.Add(this.syntaxSettings.LexStyles[i].Desc);
			}
		}
		private void FillColorThemes()
		{
			this.cbColorThemes.BeginUpdate();
			this.cbColorThemes.Items.Clear();
			foreach (ColorTheme current in this.SyntaxSettings.ColorThemes)
			{
				this.cbColorThemes.Items.Add(current.Name);
			}
			this.cbColorThemes.SelectedIndex = this.SyntaxSettings.ColorThemes.ActiveThemeIndex;
			this.cbColorThemes.EndUpdate();
		}
		private void tvProperties_AfterSelect(object sender, TreeViewEventArgs e)
		{
			Panel currentPanel = this.GetCurrentPanel();
			if (currentPanel != null)
			{
				currentPanel.Visible = true;
				currentPanel.BringToFront();
				this.UpdateImages();
			}
		}
		private void UpdateImages()
		{
			if (this.tvProperties.SelectedNode == this.rootNode)
			{
				this.generalNode.ImageIndex = 2;
			}
			else
			{
				this.generalNode.ImageIndex = 3;
			}
		}
		private int GetNodeLevel(TreeNode node)
		{
			int num = 0;
			if (node != null)
			{
				while (node.Parent != null)
				{
					node = node.Parent;
					num++;
				}
			}
			return num;
		}
		private Panel GetCurrentPanel()
		{
			Panel panel = null;
			TreeNode selectedNode = this.tvProperties.SelectedNode;
			if (selectedNode != null)
			{
				switch (this.GetNodeLevel(selectedNode))
				{
				case 0:
					panel = (this.rootNode.Nodes.Contains(this.generalNode) ? this.pnGeneral : null);
					break;
				case 1:
					if (selectedNode.Equals(this.generalNode))
					{
						panel = this.pnGeneral;
					}
					else
					{
						if (selectedNode.Equals(this.fontsNode))
						{
							panel = this.pnFontsColors;
						}
						else
						{
							if (selectedNode.Equals(this.additionalNode))
							{
								panel = this.pnAdditional;
							}
							else
							{
								if (selectedNode.Equals(this.keyboardNode))
								{
									panel = this.pnKeyboard;
								}
								else
								{
									panel = null;
								}
							}
						}
					}
					break;
				}
			}
			if (panel != null)
			{
				panel.Location = new Point(0, 0);
				panel.Size = this.pnManage.Size;
				panel.Dock = DockStyle.Fill;
			}
			return panel;
		}
		private void DlgSyntaxSettings_Activated(object sender, EventArgs e)
		{
			this.tvProperties.Focus();
		}
		private void DlgSyntaxSettings_Load(object sender, EventArgs e)
		{
			this.LoadFromResource();
			this.ControlsFromSettings();
			this.lbStyles.SelectedIndexChanged += new EventHandler(this.OnStyleSelected);
			this.lbStyles.SelectedIndex = 0;
			this.chbBold.CheckedChanged += new EventHandler(this.FontStyleChange);
			this.chbItalic.CheckedChanged += new EventHandler(this.FontStyleChange);
			this.chbUnderline.CheckedChanged += new EventHandler(this.FontStyleChange);
			this.tbDescription.TextChanged += new EventHandler(this.DescriptionChanged);
			this.cbFontName.SelectedIndexChanged += new EventHandler(this.FontNameChanged);
			this.tbFontSize.TextChanged += new EventHandler(this.FontSizeChanged);
			this.pnManage.Controls.Add(this.pnGeneral);
			this.pnManage.Controls.Add(this.pnFontsColors);
			this.pnManage.Controls.Add(this.pnAdditional);
			this.pnManage.Controls.Add(this.pnKeyboard);
			this.tvProperties.Nodes[0].ImageIndex = 0;
			this.tvProperties.Nodes[0].Expand();
			this.tvProperties.SelectedNode = ((this.tvProperties.Nodes[0].Nodes.Count > 0) ? this.tvProperties.Nodes[0].Nodes[0] : this.tvProperties.Nodes[0]);
		}
		private void LoadFromResource()
		{
			this.Text = StringConsts.DlgSyntaxSettingsCaption;
			if (this.tvProperties.Nodes.Count > 0)
			{
				this.rootNode.Text = StringConsts.PropertiesOptionsCaption;
				if (this.tvProperties.Nodes[0].Nodes.Count >= 3)
				{
					this.generalNode.Text = StringConsts.PropertiesGeneralCaption;
					this.fontsNode.Text = StringConsts.PropertiesFontsColorsCaption;
					this.additionalNode.Text = StringConsts.PropertiesAdditionalCaption;
					this.keyboardNode.Text = StringConsts.PropertiesKeyboradCaption;
				}
			}
			this.tpGeneral.Text = StringConsts.GeneralCaption;
			this.tpFontsAndColors.Text = StringConsts.FontsAndColorsCaption;
			this.tpAdditional.Text = StringConsts.AdditionalCaption;
			this.gbDocument.Text = StringConsts.DocumentCaption;
			this.gbGutterMargin.Text = StringConsts.GutterMarginCaption;
			this.gbLineNumbers.Text = StringConsts.GroupBoxLineNumbersCaption_SyntaxSettingsDlg;
			this.chbWordWrap.Text = StringConsts.WordWrapCaption_SyntaxSettingsDlg;
			this.chbHighlightUrls.Text = StringConsts.HighlightUrlsCaption;
			this.chbDragAndDrop.Text = StringConsts.DragAndDropCaption;
			this.chbVertScrollBar.Text = StringConsts.VertScrollBarCaption;
			this.chbHorzScrollBar.Text = StringConsts.HorzScrollBarCaption;
			this.chbForced.Text = StringConsts.ForcedCaption;
			this.chbShowGutter.Text = StringConsts.ShowGutterCaption;
			this.chbShowMargin.Text = StringConsts.ShowMarginCaption;
			this.laGutterWidth.Text = StringConsts.GutterWidthCaption;
			this.laMarginPosition.Text = StringConsts.MarginPositionCaption;
			this.chbLineNumbers.Text = StringConsts.CheckBoxLineNumbersCaption_SyntaxSettingsDlg;
			this.chbLineNumbersOnGutter.Text = StringConsts.LineNumbersOnGutterCaption;
			this.laFont.Text = StringConsts.FontCaption;
			this.laSize.Text = StringConsts.SizeCaption;
			this.btAddColorTheme.Text = StringConsts.AddColorTheme;
			this.btDeleteColorTheme.Text = StringConsts.DeleteColorTheme;
			this.laDisplayItems.Text = StringConsts.DisplayItemsCaption;
			this.laDescription.Text = StringConsts.DescriptionCaption;
			this.laForeColor.Text = StringConsts.ForeColorCaption;
			this.laBackColor.Text = StringConsts.BackColorCaption;
			this.gbFontAttributes.Text = StringConsts.FontAttributesCaption;
			this.chbBold.Text = StringConsts.BoldCaption;
			this.chbItalic.Text = StringConsts.ItalicCaption;
			this.chbUnderline.Text = StringConsts.UnderlineCaption;
			this.laSample.Text = StringConsts.SampleCaption;
			this.laSampleText.Text = StringConsts.SampleTextCaption;
			this.gbNavigateOptions.Text = StringConsts.NavigateOptionsCaption;
			this.gbOutlineOptions.Text = StringConsts.OutlineOptionsCaption;
			this.gbTabOptions.Text = StringConsts.TabOptionsCaption;
			this.chbBeyondEol.Text = StringConsts.BeyondEolCaption;
			this.chbBeyondEof.Text = StringConsts.BeyondEofCaption;
			this.chbMoveOnRightButton.Text = StringConsts.MoveOnRightButtonCaption;
			this.chbAllowOutlining.Text = StringConsts.AllowOutliningCaption;
			this.chbShowHints.Text = StringConsts.ShowHintsCaption;
			this.laTabSizes.Text = StringConsts.TabSizesCaption;
			this.rbInsertSpaces.Text = StringConsts.InsertSpacesCaption;
			this.rbKeepTabs.Text = StringConsts.KeepTabsCaption;
			this.btOK.Text = StringConsts.OKCaption_SyntaxSettingsDlg;
			this.btCancel.Text = StringConsts.CancelCaption_SyntaxSettingsDlg;
			this.chbWhiteSpace.Text = StringConsts.WhiteSpaceCaption_SyntaxSettingsDlg;
			this.chbLineModificator.Text = StringConsts.LineModificatorCaption_SyntaxSettingsDlg;
			this.chbLineSeparator.Text = StringConsts.LineSeparatorCaption_SyntaxSettingsDlg;
			this.laKeyboardMappingScheme.Text = StringConsts.KeyboardMappingSchemeCaption;
			this.laShowCommands.Text = StringConsts.ShowCommandsCaption;
			this.laShortcuts.Text = StringConsts.ShortcutsCaption;
			this.btSaveSchemeAs.Text = StringConsts.SaveSchemeAsCaption;
			this.btDeleteScheme.Text = StringConsts.DeleteSchemeCaption;
		}
		private void DescriptionChanged(object sender, EventArgs e)
		{
			if (!this.isControlUpdating)
			{
				this.curDesc = this.tbDescription.Text;
				this.StyleFromControl();
			}
		}
		private void FontStyleChange(object sender, EventArgs e)
		{
			if (!this.isControlUpdating)
			{
				this.curFontStyle = FontStyle.Regular;
				if (this.chbBold.Checked)
				{
					this.curFontStyle |= FontStyle.Bold;
				}
				else
				{
					this.curFontStyle &= ~FontStyle.Bold;
				}
				if (this.chbItalic.Checked)
				{
					this.curFontStyle |= FontStyle.Italic;
				}
				else
				{
					this.curFontStyle &= ~FontStyle.Italic;
				}
				if (this.chbUnderline.Checked)
				{
					this.curFontStyle |= FontStyle.Underline;
				}
				else
				{
					this.curFontStyle &= ~FontStyle.Underline;
				}
				this.StyleFromControl();
			}
		}
		private void StyleFromControl()
		{
			if (this.lbStyles.SelectedItem != null)
			{
				LexStyle selectedStyle = this.GetSelectedStyle();
				selectedStyle.ForeColor = this.curForeColor;
				selectedStyle.BackColor = this.curBkColor;
				selectedStyle.FontStyle = this.curFontStyle;
				selectedStyle.Desc = this.curDesc;
				this.UpdateStyleControls();
			}
		}
		private void StyleSelected()
		{
			this.tbDescription.Enabled = this.syntaxSettings.IsDescriptionEnabled(this.lbStyles.SelectedIndex);
			this.laDescription.Enabled = this.syntaxSettings.IsDescriptionEnabled(this.lbStyles.SelectedIndex);
			this.gbFontAttributes.Enabled = this.syntaxSettings.IsFontStyleEnabled(this.lbStyles.SelectedIndex);
			this.laBackColor.Enabled = this.syntaxSettings.IsBackColorEnabled(this.lbStyles.SelectedIndex);
			this.cbBackColor.Enabled = this.syntaxSettings.IsBackColorEnabled(this.lbStyles.SelectedIndex);
			LexStyle selectedStyle = this.GetSelectedStyle();
			if (selectedStyle != null)
			{
				this.laDescription.Enabled = true;
				this.tbDescription.Enabled = true;
				this.laForeColor.Enabled = selectedStyle.ForeColorEnabled;
				this.cbForeColor.Enabled = selectedStyle.ForeColorEnabled;
				this.laBackColor.Enabled = selectedStyle.BackColorEnabled;
				this.cbBackColor.Enabled = selectedStyle.BackColorEnabled;
				this.chbBold.Enabled = selectedStyle.BoldEnabled;
				this.chbItalic.Enabled = selectedStyle.ItalicEnabled;
				this.chbUnderline.Enabled = selectedStyle.UnderlineEnabled;
				this.curForeColor = selectedStyle.ForeColor;
				this.curBkColor = selectedStyle.BackColor;
				this.curFontStyle = selectedStyle.FontStyle;
				this.curDesc = selectedStyle.Desc;
			}
			this.UpdateStyleControls();
		}
		private void OnStyleSelected(object sender, EventArgs e)
		{
			this.StyleSelected();
		}
		private LexStyle GetSelectedStyle()
		{
			LexStyle result;
			if (this.lbStyles.SelectedItem != null)
			{
				result = this.syntaxSettings.LexStyles[this.lbStyles.SelectedIndex];
			}
			else
			{
				result = null;
			}
			return result;
		}
		private void UpdateStyleControls()
		{
			this.isControlUpdating = true;
			try
			{
				this.chbBold.Checked = ((this.curFontStyle & FontStyle.Bold) != FontStyle.Regular);
				this.chbItalic.Checked = ((this.curFontStyle & FontStyle.Italic) != FontStyle.Regular);
				this.chbUnderline.Checked = ((this.curFontStyle & FontStyle.Underline) != FontStyle.Regular);
				this.tbDescription.Text = this.curDesc;
				this.laSampleText.Font = new Font(this.laSampleText.Font.Name, (float)((int)this.laSampleText.Font.Size), this.curFontStyle);
				this.cbForeColor.SelectedColor = this.curForeColor;
				this.cbBackColor.SelectedColor = this.curBkColor;
				this.laSampleText.ForeColor = this.curForeColor;
				this.pnSampleText.BackColor = ((this.curBkColor != Color.Empty) ? this.curBkColor : this.syntaxSettings.ColorThemes.ActiveTheme[StringConsts.WindowColorInternalName].BackColor);
				this.WriteSampleText();
			}
			finally
			{
				this.isControlUpdating = false;
			}
		}
		private void FontNameChanged(object sender, EventArgs e)
		{
			if (!this.isControlUpdating && this.cbFontName.SelectedItem != null)
			{
				try
				{
					this.laSampleText.Font = new Font(this.cbFontName.Text, this.laSampleText.Font.Size, this.curFontStyle);
				}
				catch
				{
				}
				this.WriteSampleText();
			}
		}
		private void FontSizeChanged(object sender, EventArgs e)
		{
			if (!this.isControlUpdating)
			{
				this.isControlUpdating = true;
				try
				{
					int num = Math.Max(Math.Min(this.GetInt(this.tbFontSize.Text, 10), EditConsts.MaxFontSize), 1);
					if (this.tbFontSize.Text != num.ToString())
					{
						this.tbFontSize.Text = num.ToString();
					}
					this.laSampleText.Font = new Font(this.laSampleText.Font.Name, (float)num, this.curFontStyle);
					this.WriteSampleText();
				}
				finally
				{
					this.isControlUpdating = false;
				}
			}
		}
		private void WriteSampleText()
		{
			this.laSampleText.Location = new Point((this.pnSampleText.Width - this.laSampleText.Width) / 2, (this.pnSampleText.Height - this.laSampleText.Height) / 2);
		}
		private void btOK_Click(object sender, EventArgs e)
		{
			this.SettingsFromControl();
		}
		private void cbForeColor_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (!this.isControlUpdating)
			{
				this.curForeColor = this.cbForeColor.SelectedColor;
				this.StyleFromControl();
			}
		}
		private void cbBackColor_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (!this.isControlUpdating)
			{
				this.curBkColor = this.cbBackColor.SelectedColor;
				this.StyleFromControl();
			}
		}
		private void tbMarginPosition_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar > ' ')
			{
				e.Handled = (e.KeyChar < '0' || e.KeyChar > '9');
				if (!e.Handled)
				{
					try
					{
						string text = this.tbMarginPosition.Text;
						int.Parse(text.Insert(Math.Min(this.tbMarginPosition.SelectionStart, text.Length), e.KeyChar.ToString()));
					}
					catch
					{
						e.Handled = true;
						OSUtils.MessageBeep();
					}
				}
				else
				{
					OSUtils.MessageBeep();
				}
			}
		}
		private void tbGutterWidth_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (e.KeyChar > ' ')
			{
				e.Handled = (e.KeyChar < '0' || e.KeyChar > '9');
				if (!e.Handled)
				{
					try
					{
						string text = this.tbGutterWidth.Text;
						int.Parse(text.Insert(Math.Min(this.tbGutterWidth.SelectionStart, text.Length), e.KeyChar.ToString()));
					}
					catch
					{
						e.Handled = true;
						OSUtils.MessageBeep();
					}
				}
				else
				{
					OSUtils.MessageBeep();
				}
			}
		}
		private void tbShowCommands_TextChanged(object sender, EventArgs e)
		{
			this.UpdateEventHandlers();
		}
		private void lbEventHandlers_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.UpdateShortcut(this.lbEventHandlers.SelectedIndex);
		}
		private void cbColorThemes_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.cbColorThemes.SelectedIndex >= 0 && this.cbColorThemes.SelectedIndex < this.syntaxSettings.ColorThemes.Count)
			{
				this.syntaxSettings.ColorThemes.ActiveThemeIndex = this.cbColorThemes.SelectedIndex;
				this.btDeleteColorTheme.Enabled = !this.syntaxSettings.ColorThemes.ActiveTheme.ReadOnly;
				this.UpdateFontControls();
				this.FillStyles();
				this.StyleSelected();
			}
		}
		private void btAddColorTheme_Click(object sender, EventArgs e)
		{
			ColorThemes colorThemes = this.syntaxSettings.ColorThemes;
			ColorTheme colorTheme = new ColorTheme();
			colorThemes.Add(colorTheme);
			int num = colorThemes.Count - 1;
			string name = colorThemes[num].Name;
			colorThemes[num].Name = "Copy of " + name;
			colorThemes[num].ReadOnly = false;
			this.FillColorThemes();
			colorThemes.ActiveThemeIndex = num;
			this.cbColorThemes.SelectedIndex = num;
		}
		private void btDeleteColorTheme_Click(object sender, EventArgs e)
		{
			ColorThemes colorThemes = this.syntaxSettings.ColorThemes;
			if (colorThemes.ActiveThemeIndex != -1)
			{
				if (!colorThemes[colorThemes.ActiveThemeIndex].ReadOnly)
				{
					colorThemes.RemoveAt(colorThemes.ActiveThemeIndex);
					colorThemes.ActiveThemeIndex--;
					this.FillColorThemes();
					this.cbColorThemes.SelectedIndex = colorThemes.ActiveThemeIndex;
				}
			}
		}
		private void cbColorThemes_Leave(object sender, EventArgs e)
		{
			if (this.cbColorThemes.SelectedIndex == -1)
			{
				if (!this.syntaxSettings.ColorThemes.ActiveTheme.ReadOnly && this.cbColorThemes.Text != string.Empty)
				{
					this.syntaxSettings.ColorThemes.ActiveTheme.Name = this.cbColorThemes.Text;
					this.FillColorThemes();
				}
			}
		}
		private void UpdateActiveColorThemeFont()
		{
			if (!this.isFontControlsUpdating)
			{
				if (this.cbFontName.SelectedIndex != -1 && this.tbFontSize.Text != null)
				{
					string text = this.cbFontName.SelectedItem.ToString();
                    //this.syntaxSettings.Font = new Font(text, (float)this.GetInt(this.tbFontSize.Text, 10), FontInfos.GetAvailableFontStyle(new FontFamily(text), FontStyle.Regular));
				}
			}
		}
		private void cbFontName_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.UpdateActiveColorThemeFont();
		}
		private void tbFontSize_Leave(object sender, EventArgs e)
		{
			this.UpdateActiveColorThemeFont();
		}
		public DialogResult Execute(EditorSettingsTab hiddenTabs)
		{
			return this.Execute(hiddenTabs, null);
		}
		public DialogResult Execute(EditorSettingsTab hiddenTabs, IWin32Window owner)
		{
			this.UpdateHiddenTabs(hiddenTabs);
			return (owner != null) ? base.ShowDialog(owner) : base.ShowDialog();
		}
      
		
	}
}
